﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 练习4
{
    class Program
    {
        static void Main(string[] args)
        {
            double sum = 1;
            int count = 1;
            do
            {
                if (count%2==1)
                {
                    sum = sum - 1.0 / (2*count+1);
                    count++;
                }
                if (count%2==0)
                {
                    sum = sum + 1.0 / (2*count + 1);
                    count++;
                }
            } while (1.0/(2*count+1)>=0.000001);
            Console.WriteLine(4*sum);
            Console.ReadKey();
        }
    }
}
